{template '_header'}

<div class="page-header">
    当前位置：<span class="text-primary">全部模板</span>
</div>

<div class="page-content">
<form action="./index.php" method="get">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="mx_shop" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="store.diypage" />
    <div class="page-toolbar">
        <div class="col-sm-4">
            {ifp 'store.diypage.add'}
                <a class='btn btn-primary btn-sm' href="{php echo webUrl('store/diypage/add')}"><i class='fa fa-plus'></i> 添加模板</a>
            {/if}
        </div>
        <div class="col-sm-7 pull-right">
            <div class="input-group">
                <div class="input-group-select">
                    <select name="status" class="form-control  input-sm" style="width:120px;">
                        <option value="" {if $_GPC['status']==''} selected{/if}>模板状态</option>
                        <option value="0" {if $_GPC['status']=='0'} selected{/if}>禁用</option>
                        <option value="1" {if $_GPC['status']=='1'} selected{/if}>启用</option>
                    </select>
                </div>
                <input type="text" class="input-sm form-control" name="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键字进行搜索">
                <span class="input-group-btn">
                    <button class="btn btn-primary" type="submit"> 搜索</button>
                </span>
            </div>
        </div>
    </div>
</form>

{if empty($list)}
    <div class="panel panel-default">
        <div class="panel-body" style="text-align: center;padding:30px;">未查询到相关模板</div>
    </div>
{else}
    <div class="page-table-header">
        <input type="checkbox">
        <div class="btn-group">
            {ifp 'store.diypage.status'}
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要启用?" data-href="{php echo webUrl('store/diypage/status', array('status'=>1))}" disabled="disabled">
                <i class="icow icow-qiyong"></i> 启用
            </button>
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要禁用?" data-href="{php echo webUrl('store/diypage/status', array('status'=>0))}" disabled="disabled">
                <i class="icow icow-jinyong"></i> 禁用
            </button>
            {/if}
            {ifp 'store.diypage.delete'}
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要删除?" data-href="{php echo webUrl('store/diypage/delete', array('status'=>1))}" disabled="disabled">
                <i class="icow icow-shanchu1"></i> 删除
            </button>
            {/if}
        </div>
    </div>
    <table class="table table-hover table-responsive">
        <thead>
        <tr>
            <th style="width:25px;"></th>
            <th>模板名称</th>
            <th style="width: 150px;">创建时间</th>
            <th style="width: 150px;">最后修改时间</th>
            <th style="width: 90px">状态</th>
            <th style="width: 90px">操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $item}
            <tr {if empty($item['uniacid'])}style="background: #eee;"{/if}>
                <td>
                    {if empty($item['uniacid'])}-
                    {else}
                        <input type="checkbox" value="{$item['id']}">
                    {/if}
                </td>
                <td>{$item['name']}</td>
                <td>{if empty($item['uniacid'])}-{else}{php echo date('Y-m-d H:i:s', $item['createtime'])}{/if}</td>
                <td>{if empty($item['uniacid'])}-{else}{php echo date('Y-m-d H:i:s', $item['lastedittime'])}{/if}</td>
                <td>
                    {if empty($item['uniacid'])}
                        <span class="label label-primary">默认模板</span>
                    {else}
                        <span class="label {if $item['status']==1}label-success{else}label-default{/if}"
                            data-toggle='ajaxSwitch'
                            data-switch-value='{$item['status']}'
                            data-switch-value0='0|禁用状态|label label-default|{php echo webUrl('store/diypage/status',array('status'=>1,'id'=>$item['id']))}'
                            data-switch-value1='1|启用状态|label label-success|{php echo webUrl('store/diypage/status',array('status'=>0,'id'=>$item['id']))}'
                            style="cursor: pointer;"
                        >{if $item['status']==1}启用状态{else}禁用状态{/if}</span>
                    {/if}
                </td>
                <td>
                    {ifp 'store.diypage.preview'}
                        <a class="btn btn-default btn-sm btn-op btn-operation" href="{php echo webUrl('store/diypage/preview', array('id'=>$item['id'], 'preview'=>1))}" target="_blank">
                             <span data-toggle="tooltip" data-placement="top" title="" data-original-title="预览">
                                     <i class='icow icow-chakan-copy'></i>
                                </span>
                        </a>
                    {/if}
                    {if !empty($item['uniacid'])}
                        {ifp 'store.diypage.edit'}
                            <a class="btn btn-default btn-sm btn-op btn-operation" href="{php echo webUrl('store/diypage/edit', array('id'=>$item['id']))}">
                                <span data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑">
                                     <i class='icow icow-bianji2'></i>
                                </span>
                            </a>
                        {/if}
                        {ifp 'store.diypage.delete'}
                            <a class="btn btn-default btn-sm btn-op btn-operation" data-toggle="ajaxRemove" href="" data-confirm="确定要删除此模板吗？">
                                 <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                                     <i class='icow icow-shanchu1'></i>
                                </span>
                            </a>
                        {/if}
                    {/if}
                </td>
            </tr>
        {/loop}
        </tbody>
        <tfoot>
            <tr>
                <td><input type="checkbox"></td>
                <td>
                    <div class="btn-group">
                        {ifp 'store.diypage.status'}
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要启用?" data-href="{php echo webUrl('store/diypage/status', array('status'=>1))}" disabled="disabled">
                            <i class="icow icow-qiyong"></i> 启用
                        </button>
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要禁用?" data-href="{php echo webUrl('store/diypage/status', array('status'=>0))}" disabled="disabled">
                            <i class="icow icow-jinyong"></i> 禁用
                        </button>
                        {/if}
                        {ifp 'store.diypage.delete'}
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch" data-confirm="确认要删除?" data-href="{php echo webUrl('store/diypage/delete', array('status'=>1))}" disabled="disabled">
                            <i class="icow icow-shanchu1"></i> 删除
                        </button>
                        {/if}
                    </div>
                </td>
                <td colspan="4" class="text-right">
                    {$pager}
                </td>
            </tr>
        </tfoot>
    </table>
{/if}
</div>
{template '_footer'}